<template>
	<view>
		<input type="text" placeholder="请输入昵称" v-model="item.nickname">
		<input type="text" placeholder="请输入电话" v-model="item.tel">
		<input type="text" placeholder="请输入地址" v-model="item.address">
		<button @click="handleADD">确定新增</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				item: {
					nickname: '',
					tel: '',
					address: '',
					id: new Date().getTime().toString()
				}
			};
		},
		methods: {
			async handleADD() {
				console.log(this.item)
				const resp =  await uni.request({
					url: 'http://localhost:3000/addressList',
					method: 'POST',
					data: this.item
				})
				uni.navigateTo({
					url: '/pages/addressList/addressList'
				})
			}
		}
	}
</script>

<style lang="scss">
input {
	border: 2rpx solid #ccc;
	margin: 10rpx 0;
	height: 60rpx;
}
</style>
